package ru.gerunn.quartz;

import java.text.ParseException;

import org.quartz.CronExpression;
import org.quartz.CronTrigger;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.impl.StdSchedulerFactory;

public class CronTriggerQuartzExample {

	public static void main(String[] args) {
		try {
			Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();

			JobDetail jobDetail = new JobDetail("jobName", "groupName", SimpleQuartzJob.class);
			CronTrigger cronTrigger = new CronTrigger("cronTrigger", "cronTriggerGroup");
			CronExpression cronExpression = new CronExpression("* * * * * ?");
			cronTrigger.setCronExpression(cronExpression);
			scheduler.scheduleJob(jobDetail, cronTrigger);

			scheduler.start();
			//scheduler.shutdown();
		} catch (SchedulerException se) {
			se.printStackTrace();
		} catch (ParseException e) {
			e.printStackTrace();
		}
	}

}
